// JavaScript Document
$(function() {
	getPageHtml=function getPageHtml(totalPages,pageNo){
		var htmlStr="";
		if(totalPages>0){
			var next=pageNo+1;
			var pre=pageNo-1;
			if(pageNo<4){
				if(pageNo==1){
					htmlStr+="<span class=\"previous disabled\"> 上一页 </span>";
					
				}else{
					htmlStr+="<span class=\"previous\"> 上一页 </span>";
				}
				for(i=1;i<=totalPages;i++){
					if(i==6){
						break;
					}
					if(i==pageNo){
						htmlStr+="<span class=\"pageNum yes\">"+i+"</span>";
					}else{
						htmlStr+="<span class=\"pageNum\">"+i+"</span>";
					}
				}
				if(totalPages>6){
					htmlStr+="<span class=\"pageMove\">...</span>";
					htmlStr+="<span class=\"next\">下一页</span>";
				}else{
					if(pageNo==totalPages){
						htmlStr+="<span class=\"next disabled\">下一页</span>";
					}else{
						htmlStr+="<span class=\"next\">下一页</span>";
					}
				}
			}else{
				htmlStr+="<span class=\"previous\"> 上一页 </span>";
				htmlStr+="<span class=\"pageNum\">1</span>";
				htmlStr+="<span class=\"pageMove\">...</span>";
				var start,end;
				start=pageNo-1;
				if(pageNo+1<totalPages){
					end=pageNo+1;
				}else{
					end=totalPages;
				}
				for(i=start;i<=end;i++){
					if(i==pageNo){
						htmlStr+="<span class=\"pageNum yes\">"+i+"</span>";
					}else{
						htmlStr+="<span class=\"pageNum\">"+i+"</span>";
					}
				}
				if(end<totalPages){
					htmlStr+="<span class=\"pageMove\">...</span>";
					htmlStr+="<span class=\"next\">下一页</span>";
				}else{
					if(pageNo==totalPages){
						htmlStr+="<span class=\"next disabled\">下一页</span>";
					}else{
						htmlStr+="<span class=\"next\">下一页</span>";
					}
				}
			}
			
			
		}
		return htmlStr;
		
	};

});
